package com.ruoyi.psi.purchase.purchasereturn.mapper;


import com.ruoyi.psi.base.product.domain.ProduceCheck;
import com.ruoyi.psi.purchase.purchasereturn.domain.PurchaseReturn;
import com.ruoyi.psi.purchase.purchasereturn.domain.PurchaseReturnList;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 采购退货
 * 数据层
 */
public interface PurchaseReturnMapper {
    /**
     * 采购订单退货查询
     * @param purchaseReturn
     * @return
     */
    public List<PurchaseReturn> selectPurchaseReturnList(PurchaseReturn purchaseReturn);

    /**
     * 新增时获取入库单详细
     * @param purchaseStorageId
     * @return
     */
    public List<PurchaseReturnList> getPurchaseStorageForReturn(String purchaseStorageId);


    /**
     * 获取入库订单对应已退回数量
     * @param purchaseStorageId 入库编号
     * @param produceId 产品编号
     * @return
     */
    public Double getPurchaseStorageReturnNumber(@Param("purchaseStorageId") String purchaseStorageId,@Param("produceId") String produceId);
    /**
     * 按编号查询
     * @param purchaseReturnId 采购订单退货编号
     * @return
     */
    public PurchaseReturn selectPurchaseReturnById(String purchaseReturnId);
    /**
     * 获取最新的一条采购退货编号
     * @return
     */
    public String getPurchaseReturnId();
    /**
     * 采购订单退货新增
     * @param purchaseReturn
     * @return
     */
    public int insertPurchaseReturn(PurchaseReturn purchaseReturn);

    /**
     * 采购订单退货更新
     * @param purchaseReturn
     * @return
     */
    public int updatePurchaseReturn(PurchaseReturn purchaseReturn);

    /**
     * 更新采购订单退货删除标志位
     * @param purchaseReturn
     * @return
     */
    public int updatePurchaseReturnDeleteFlag(PurchaseReturn purchaseReturn);

    /**
     * 采购订单退货详细查询
     * @param purchaseReturnList
     * @return
     */
    public List<PurchaseReturnList> selectPurchaseReturnListList(PurchaseReturnList purchaseReturnList);

    /**
     * 查询采购订单退货对应的所有产品详细
     * @param purchaseReturnId 采购订单退货编号
     * @return
     */
    public List<PurchaseReturnList> selectPurchaseReturnListListById(String purchaseReturnId);

    /**
     * 查询采购订单退货对应的指定产品详细
     * @param purchaseReturnId
     * @return
     */
    public PurchaseReturnList  selectPurchaseReturnListById( @Param("purchaseReturnId")String purchaseReturnId,  @Param("produceId")String produceId);

    /**
     * 采购订单退货详细新增
     * @param purchaseReturnList
     * @return
     */
    public int insertPurchaseReturnList(PurchaseReturnList purchaseReturnList);

    /**
     * 采购订单退货详细更新
     * @param purchaseReturnList
     * @return
     */
    public int updatePurchaseReturnList(PurchaseReturnList purchaseReturnList);

    /**
     * 删除采购订单退货详细
     * @param purchaseReturnId  采购订单退货编号
     * @param produceId 产品编号
     * @return
     */
    public int deletePurchaseReturnListById( @Param("purchaseReturnId")String purchaseReturnId,  @Param("produceId")String produceId);

    /**
     * 获取指定产品采购退货数量
     * @param produceCheck
     */
    public Double getPurchaseReturnProduceNum(ProduceCheck produceCheck);
}
